<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%--
  Created by IntelliJ IDEA.
  User: lupf
  Date: 2016/5/4
  Time: 14:09
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<body>
<div>
    <shiro:hasPermission name="mchntClearDetailAudit_auditSuccese">
        <button ng-click="vm.audit(vm.item.list[0].handleBatchNo,'02')" ng-if="vm.item.list[0].auditStatus == '01'">
            审核成功
        </button>
    </shiro:hasPermission>
    <shiro:hasPermission name="mchntClearDetailAudit_auditFail">
        <button ng-click="vm.auditFail(vm.item.list[0].handleBatchNo,vm.item.list[0].clrDate,vm.item.list[0].clrType)"
                ng-if="vm.item.list[0].auditStatus == '01'">
            审核失败
        </button>
    </shiro:hasPermission>
    <table table-detail>
        <thead>
        <tr>
            <th>序号</th>
            <th>商户代码</th>
            <th>分账商户</th>
            <th>机构代码</th>
            <td>结算类型</td>
            <th>结算开始时间</th>
            <th>结算结束时间</th>
            <th ng-if="vm.item.list[0].clrType != '03'">应付笔数</th>
            <th ng-if="vm.item.list[0].clrType != '03'">应付金额</th>
            <th ng-if="vm.item.list[0].clrType != '03'">应退笔数</th>
            <th ng-if="vm.item.list[0].clrType != '03'">应退金额</th>
            <th ng-if="vm.item.list[0].clrType != '03' || vm.item.list[0].mchntCodeSplit == ''">本金净额</th>
            <th ng-if="vm.item.list[0].clrType == '03'">应收佣金</th>
            <th ng-if="vm.item.list[0].clrType == '03'">应退佣金</th>
            <th ng-if="vm.item.list[0].clrType == '03' || vm.item.list[0].mchntCodeSplit == ''">佣金净额</th>
            <th>审核状态</th>
            <th>申请状态</th>
            <th ng-if="vm.item.list[0].clrType != '03'">机构资金</th>
            <th ng-if="vm.item.list[0].clrType != '03'">实付日期</th>
            <th>经办批次号</th>
            <th>经办人</th>
            <th>操作</th>
        </tr>
        </thead>

        <tbody ng-repeat-start="bean in vm.item.list track by $index">
        <tr my-color="bean.clrAdjustFlag" my-color-true="02" my-color-code="#f08080">
            <td>{{$index + 1}}</td>
            <td>{{vm.cached.MERCHANT_CODE[bean.mchntCode]}}({{bean.mchntCode}})</td>
            <td>{{vm.cached.MERCHANT_CODE[bean.mchntCodeSplit]}}({{bean.mchntCodeSplit}})</td>
            <td>{{vm.cached.COMANY_CODE[bean.payOrgCode]}}({{bean.payOrgCode}})</td>
            <td>{{vm.cached.CLR_TYPE[bean.clrType]}}</td>
            <td>{{bean.clrStartDate | date:'yyyyMMdd'}}</td>
            <td>{{bean.clrEndDate | date:'yyyyMMdd'}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{bean.payableCount}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{bean.payableAmt/100 | currency:'￥'}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{bean.receivableCount}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{bean.receivableAmt/100 | currency:'￥'}}</td>
            <td ng-if="vm.item.list[0].clrType != '03' || vm.item.list[0].mchntCodeSplit == ''">{{(bean.payableAmt - bean.receivableAmt)/100 | currency:'￥'}}</td>
            <td ng-if="vm.item.list[0].clrType == '03'">{{bean.feeAmt/100 | currency:'￥'}}</td>
            <td ng-if="vm.item.list[0].clrType == '03'">{{bean.reFeeAmt/100 | currency:'￥'}}</td>
            <td ng-if="vm.item.list[0].clrType == '03' || vm.item.list[0].mchntCodeSplit == ''">{{(bean.feeAmt - bean.reFeeAmt)/100 | currency:'￥'}}</td>
            <td>{{{'01':'未审核','02':'审核成功','03':'审核失败'}[bean.auditStatus]}}</td>
            <td>{{vm.cached.PAY_REQ_FLAG[bean.payReqFlag]}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{bean.cashTransFlag == 1 ? '已收付' : ''}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{bean.cashTransDateP | date:'yyyyMMdd' }}</td>
            <td>{{bean.handleBatchNo}}</td>
            <td>{{bean.manager}}</td>
            <td>
                <button ng-show="bean.clrAdjustFlag == '02'" ng-click="vm.queryAdjust(bean)">查看</button>
            </td>
        </tr>
        </tbody>
        <tbody ng-repeat-end uib-collapse="bean.collapse">
        <tr class="ignoreRow">
            <th colspan="7">调整</th>
            <td ng-if="vm.item.list[0].clrType != '03'">{{vm.adjustModel.payableCount | currency:''}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{vm.adjustModel.payableAmt | currency:''}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{vm.adjustModel.receivableCount | currency:''}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{vm.adjustModel.receivableAmt | currency:''}}</td>
            <td>{{vm.adjustModel.payableAmt - vm.adjustModel.receivableAmt | currency:''}}</td>
            <td ng-if="vm.item.list[0].clrType == '03'">{{vm.adjustModel.feeAmt | currency:''}}</td>
            <td ng-if="vm.item.list[0].clrType == '03'">{{vm.adjustModel.reFeeAmt | currency:''}}</td>
            <td>{{vm.adjustModel.feeAmt - vm.adjustModel.reFeeAmt | currency:''}}</td>
            <td colspan="7">备注：{{vm.adjustModel.remark}}</td>
        </tr>
        <tr class="ignoreRow">
            <th colspan="7">调整后</th>
            <td ng-if="vm.item.list[0].clrType != '03'">{{bean.payableCount - (-vm.adjustModel.payableCount)}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{bean.payableAmt/100 - (-vm.adjustModel.payableAmt) | currency:'￥'}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{bean.receivableCount - (-vm.adjustModel.receivableCount)}}</td>
            <td ng-if="vm.item.list[0].clrType != '03'">{{bean.receivableAmt/100 - (-vm.adjustModel.receivableAmt) | currency:'￥'}}</td>
            <td>{{((bean.payableAmt - bean.receivableAmt)/100) - (-(vm.adjustModel.payableAmt -
                vm.adjustModel.receivableAmt)) | currency:'￥'}}
            </td>
            <td ng-if="vm.item.list[0].clrType == '03'">{{bean.reFeeAmt/100 - (-vm.adjustModel.feeAmt) | currency:'￥'}}</td>
            <td ng-if="vm.item.list[0].clrType == '03'">{{bean.feeAmt/100 - (-vm.adjustModel.reFeeAmt) | currency:'￥'}}</td>
            <td>{{((bean.reFeeAmt - bean.feeAmt)/100) - (-(vm.adjustModel.feeAmt - vm.adjustModel.reFeeAmt)) |
                currency:'￥'}}
            </td>
            <td colspan="8"></td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>
